<?php echo $this->Html->script(array('users.view','actions'),$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));?>
<?php echo $this->Html->css(array('users.view','provider.index.images','lastminute-left','search-left','form','actions'),null,array('inline'=>false));?>


<div class="content">
	<div class="left-column">
		
		<?php echo $this->Yachts->search_form_left();?>		
		<div class="clr"></div>	
		<?php echo $this->Yachts->lastminute(2);?>
		<div class="clr"></div>	
	</div>
	<div class="middle-column main-column">
		<div class="box corners">	
			<h2><?php echo __('My payments')?></h2>
			<table width="100%" style="padding-top:0px; margin: 0px;" cellpadding="0" cellspacing="0">
				<tr>
					<td><?php echo __('Custommer',true)?></td><td><?php echo $this->data['User']['first_name']?> <?php echo $this->data['User']['last_name']?></td>
				</tr>
				<tr>
					<td><?php echo __('Email',true)?></td><td><?php echo $this->data['User']['email']?></td>
				</tr>
				<tr>
					<td><?php echo __('Phone',true)?></td><td><?php echo $this->data['User']['phone1']?></td>
				</tr>

			</table>
				
					
			<?php if (!empty($this->data['VidYachtCharter'])):?>
				<table cellpadding = "0" cellspacing = "0" class="index">
				<?php
					$i = 0;
					foreach ($this->data['VidYachtCharter'] as $yachtCharter):
						$class = null;
						if ($i++ % 2 == 0) {
							$class = ' class="altrow"';
						}
					?>			
						
						
					<tr<?php echo $class;?>>
						<td class="image-index">
							<div class="gallery">
							<?php 
							$file = $fileUpload->image($yachtCharter['file_name'],array('autoResize'=>true,'imagePathOnly'=>true,'class'=>'large','alt'=> $yachtCharter['name'],'width'=>800,'height'=>800));
							$thumb = $fileUpload->image($yachtCharter['file_name'],array('autoResize'=>true,'imagePathOnly'=>true,'class'=>'thumb','alt'=> $yachtCharter['name'],'width'=>150,'height'=>140));
						
							$ext = strtolower($fileUpload->_getExt());
							echo $html->link("&nbsp;",$file,array('escape'=>false,'class'=>"highslide",  'onclick'=>"return hs.expand(this)",'style'=>"background: url(".$thumb.") center no-repeat;"))?>
							</div>
						</td>
						<td>
							
							<table width="100%" cellpadding="1" cellspacing="1" class="data">
								<tr>
									<td colspan="2" class="index-yachts-name"><?php echo $yachtCharter['name']; ?>&nbsp;</td>
									<td class="index-yachts-name"><?php echo $yachtCharter['date_from']; ?>&nbsp;</td>
									<td class="index-yachts-name"><?php echo $yachtCharter['date_to']; ?>&nbsp;</td>
									<td align="left"><?php echo __('Total price')?></td>
									<td  class="index-yachts-price" align="right">
										<?php 
											echo $this->Number->currency($yachtCharter['total_price'],'EUR');
											$left_to_pay = $yachtCharter['total_price'];
										?>&nbsp;
									</td>
								</tr>
								<tr>
									<td valign="top">
										<?php echo __('Destination') ?>
									</td>
									<td colspan="3" valign="top">
										<?php echo $yachtCharter['destination_name'];?>
									</td>
									<td colspan="2" valign="top" align="left">
										<h3><?php echo __('been paid',true)?></h3>
										<table style="width: 100%">
											<?php 
											if(isset($yachtCharter['YachtChartersPayment'])){
											foreach ($yachtCharter['YachtChartersPayment'] as $pkey => $p) {?>
											<tr>
												<td width="80%" align="left"><?php echo $p['description']?>&nbsp;</td>
												<td width="20%" align="right">
													<?php 
														echo $this->Number->currency($p['amout'],'EUR');
														$left_to_pay = $left_to_pay - $p['amout'];
													?>&nbsp;
												</td>
											</tr>
											<?php }}?>
											<tr>
												<td  style="border-top: solid 2px #666;" align="left"><?php echo __('left to pay:',true)?></td>
												<td  style="border-top: solid 2px #666;" align="right" class="index-yachts-price"><?php echo $this->Number->currency($left_to_pay,'EUR'); ?> </td>
											</tr>	
										</table>
									</td>
								</tr>
							</table>
							<div class="actions">
							<?php echo $this->Html->link(__('View', true), array('controller' => 'yacht_charters', 'action' => 'view', $yachtCharter['id']),array('class'=>'view')); ?>
							</div>
						</td>
					</tr>
			
				<?php endforeach; ?>
				</table>
			<?php endif; ?>	
		</div>
	</div>
	
	<div class="right-column">
		<?php echo $this->element('user_main_left_menu')?>
	</div>
		
</div>


<?php if($session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'admin' || $session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'manag'){?>
	<div class="actions main_actions">
		<h3><?php __('Actions'); ?></h3>
		<ul>
			<li><?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('User.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('User.id'))); ?></li>
			<li><?php echo $this->Html->link(__('List Users', true), array('action' => 'index'));?></li>
	
			<li><?php echo $this->Html->link(__('New User', true), array('action' => 'add_user')); ?> </li>
			<li><?php echo $this->Html->link(__('List Yacht Charters', true), array('controller' => 'yacht_charters', 'action' => 'index')); ?> </li>
			<li><?php echo $this->Html->link(__('New Yacht Charter', true), array('controller' => 'yacht_charters', 'action' => 'add')); ?> </li>
		</ul>
	</div>
<?php }?>	

<div class="clr"></div>
